package com.xwli.springcloud.controller;

import com.alibaba.fastjson.JSON;
import com.xwli.springcloud.model.PaeQueryTestSvcReqEntity;
import com.xwli.springcloud.projo.ServiceOrderTest;
import com.xwli.springcloud.service.ServiceOrderTestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: soc-demo
 * @description:
 * @author: fsp
 * @create: 2023-02-19 20:49
 **/

@Slf4j
@RestController
@RequestMapping("/query/order")
public class ServiceOrderTestController {

    @Autowired
    private ServiceOrderTestService serviceOrderTestService;

    /**
    * @description: 分页查找
    * @params: [pageIndex, pageSize]
    * @return: org.springframework.http.ResponseEntity
    * @author: xwli
    * @date: 2023/2/21 21:15
    */
    @PostMapping("/pageQuery")
    public ResponseEntity<List<ServiceOrderTest>> pageQueryTestSvc(@RequestBody PaeQueryTestSvcReqEntity paeQueryTestSvcReqEntity){
        log.info("分页查找接口接收到请求:{}", JSON.toJSONString(paeQueryTestSvcReqEntity));
        return serviceOrderTestService.pageQueryTestSvc(paeQueryTestSvcReqEntity);
    }

    @GetMapping("/count")
    public ResponseEntity<Integer> orderCountTestSvc(){
        return serviceOrderTestService.orderCountTestSvc();
    }
}
